
package flc.ast.dialog;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.lxj.xpopup.core.AttachPopupView;

import java.util.ArrayList;
import java.util.List;

import flc.ast.R;
import flc.ast.adapter.ScaleAdapter;
import flc.ast.bean.MyScaleBean;

public class EditDialog extends AttachPopupView implements View.OnClickListener {

    private TextView tvRename, tvDelete;

    public EditDialog(@NonNull Context context) {
        super(context);
    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.dialog_edit_style;
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        initView();
    }

    protected void initView() {
        tvRename = findViewById(R.id.tvRename);
        tvDelete = findViewById(R.id.tvDelete);

        tvRename.setOnClickListener(this);
        tvDelete.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tvRename://重命名
                dismiss();
                if (listener != null) {
                    listener.clickRename();
                }
                break;
            case R.id.tvDelete://删除
                dismiss();
                if (listener != null) {
                    listener.clickDelete();
                }
            default:
                break;
        }
    }

    private Ilistener listener;

    public void setListener(Ilistener listener) {
        this.listener = listener;
    }

    public interface Ilistener {
        void clickRename();

        void clickDelete();
    }

}
